{template '_header'}
<style type="text/css">
    .table_kf {display: none;}
    .table_kf.active {display: table-footer-group;}
</style>
<div class="page-header">
    当前位置：<span class="text-primary">购物送券</span>
</div>
<div class="page-content">
    <div class="page-toolbar">
        {ifp 'sale.coupon'}
        {if $data['isopengoodssendtask']==1}
        <a class='btn btn-danger btn-sm' href="{php echo webUrl('sale/coupon/goodssend/closetask')}"><i class='fa fa-close'></i> 关闭功能</a>
        {else}
        <a class='btn btn-warning btn-sm' href="{php echo webUrl('sale/coupon/goodssend/opentask')}"><i class='fa fa-plus'></i> 开启功能</a>
        {/if}
        <a class='btn btn-primary btn-sm' href="{php echo webUrl('sale/coupon/goodssend/add')}"><i class='fa fa-plus'></i> 添加任务</a>
        {/if}
    </div>
    <ul class="nav nav-arrow-next nav-tabs" id="myTab" >
        <li style="position: relative;">
            <a href="{php echo webUrl('sale/coupon/shareticket')}">分享发券</a>
            <span style="position:absolute;right: 9px;top: -7px;"><img src="../addons/mx_shop/static/images/new.png" alt="" ></span>
        </li>
        <li style="position: relative;">
            <a href="{php echo webUrl('sale/coupon/setticket')}">新人发券</a>
            <span style="position:absolute;right: 9px;top: -7px;"><img src="../addons/mx_shop/static/images/new.png" alt="" ></span>
        </li>
        <li class="" >
            <a href="{php echo webUrl('sale/coupon/sendtask')}">满额送券</a>
        </li>
        <li class="active">
            <a href="{php echo webUrl('sale/coupon/goodssend')}">购物送券</a>
        </li>
        <li >
            <a href="{php echo webUrl('sale/coupon/usesendtask')}">用券送券</a>
        </li>
    </ul>
    <form action="" method="post">
        {if count($goodssends)>0}
        <table class="table table-hover table-responsive">
            <thead class="navbar-inner">
            <tr>
                <th style="width: 70px">商品图片</th>
                <th style="">商品信息</th>
                <th style="width: 80px">优惠券图片</th>
                <th style="">优惠券名称</th>
                <th>赠送数量</th>
                <th  style="width: 190px">活动时间</th>
                <th style="width: 80px;">剩余数量</th>
                <th style="width: 80px">状态</th>
                <th style="width:65px">操作</th>
            </tr>
            </thead>
            <tbody>

            {loop $goodssends $item}
            <tr>
                <td>
                    <img src="{php echo tomedia($item['ghumb'])}" style="width:40px;height:40px;padding:1px;border:1px solid #ccc;"  onerror="this.src='../addons/mx_shop/static/images/nopic.png'"/>
                </td>
                <td>
                    {$item['title']}
                </td>
                <td>
                    <img src="{php echo tomedia($item['cthumb'])}" style="width:40px;height:40px;padding:1px;border:1px solid #ccc;"  onerror="this.src='../addons/mx_shop/static/images/nopic.png'"/>
                </td>
                <td>
                    {$item['couponname']}
                </td>
                <td>
                    {$item['sendnum']}
                </td>
                <td>
                    {php echo date("Y-m-d ", $item['starttime'])} - {php echo date("Y-m-d", $item['endtime'])}
                </td>
                <td>
                    {$item['num']}
                </td>
                <td>
                    {if  $item['status']==1}开启{else}关闭{/if}
                </td>
                <td  style="overflow:visible;position:relative;">
                    {ifp 'sale.coupon'}
                    <a  class='btn btn-default btn-sm btn-operation btn-op' href="{php echo webUrl('sale.coupon.goodssend/edit', array('id' => $item['id'],'page'=>$page))}">
                         <span data-toggle="tooltip" data-placement="top" title="" data-original-title=" {ifp 'sale.coupon'}编辑{else}查看{/if}">
								<i class='icow icow-bianji2'></i>
						   </span>
                    </a>
                    {/if}
                    {ifp 'sale.coupon'}
                    <a  class='btn btn-default btn-sm btn-operation btn-op' data-toggle='ajaxRemove' href="{php echo webUrl('sale.coupon.goodssend/delete', array('id' => $item['id']))}" data-confirm='确认要删除吗?？'>
                        <span data-toggle="tooltip" data-placement="top" title="" data-original-title="删除">
                            <i class='icow icow-shanchu1'></i>
                       </span>
                    </a>
                    {/if}
                </td>
            </tr>
            {/loop}

            </tbody>
            <tfoot>
                <tr>
                    <td colspan="9" style="text-align: right">
                        <span class="pull-right" style="line-height: 28px;">(共{php echo count($list)}条记录)</span>
                        {$pager}
                    </td>
                </tr>
            </tfoot>
        </table>
        {else}
        <div class='panel panel-default'>
            <div class='panel-body' style='text-align: center;padding:30px;'>
                暂时没有任何优惠券
            </div>
        </div>
        {/if}
    </form>
</div>
{template '_footer'}
